home *** CD-ROM | disk | FTP | other *** search
/ PsL Monthly 1993 December / PSL Monthly Shareware CD-ROM (December 1993).iso / prgmming / dos / basic / bprep.exe / BPREP.DOC < prev    next >
Encoding:
Text File  |  1992-02-25  |  22.6 KB  |  857 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.                                    BPREP
  16.  
  17.                 A preprocessor utility for the BASIC language
  18.  
  19.                                Version  2.00
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.        [c] 1991 Applied Design Group, E 3707 Pacific, Spokane, WA 99202
  51.  
  52.                                (509) 535-7829
  53.  
  54.  
  55.  
  56.  
  57.  
  58.                         Table Of Contents
  59.                 ____________________________________
  60.  
  61.  
  62.             License Policy                              1
  63.  
  64.             Disclaimer                                  2
  65.  
  66.             Introduction                                3
  67.  
  68.             Compatibility                               4
  69.  
  70.             Where to reach us                           5
  71.  
  72.             Using BPREP                                 6
  73.  
  74.             Command Line Switches                       7
  75.  
  76.             The Directives                              8
  77.  
  78.                     #include                            9
  79.                     #define                            10
  80.                     #undef                             12
  81.                     #ifdef                             13
  82.                     #ifndef                            14
  83.                     #endif                             15
  84.  
  85.             Professional Version                       16
  86.  
  87.             Registration Information                   17
  88.  
  89.             Other Applied Design Group Products        18
  90.  
  91.             Order Form
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98. License Policy:                                                 Page 1
  99.  
  100.  
  101.  
  102.      BPREP and its documentation are copyright [c] 1991 Applied Design Group
  103.      all rights reserved.  BPREP may not be circulated in any incomplete
  104.      or modified form, nor sold for profit, without written permission
  105.      of the author.  You may use the unregistered shareware version of
  106.      BPREP for a reasonable evaluation period.  After the evaluation
  107.      period, you must either register BPREP or discontinue its use.  If
  108.      you register BPREP, you may continue to use the unregistered BPREP
  109.      program until you receive the registered version.
  110.  
  111.  
  112.  
  113.      If you distribute this software to others, you are required to
  114.      distribute the ENTIRE package consisting of the following files:
  115.  
  116.                BPREP.EXE      -    BASIC Preprocessor
  117.                BPREP.DOC      -    BPREP Documentation
  118.                README         -    Read file
  119.                HISTORY        -    History of BPREP
  120.                SAMPLE.B       -    Sample source file
  121.                SAMPLE.INC     -    Sample include file
  122.                SAMPLE.BAS     -    Sample file processed with BPREP
  123.                BP.BAT         -    batch file to run BPREP
  124.  
  125.  
  126.  
  127.  
  128.  
  129. Commercial sale:
  130.  
  131.      Any software dealer or library may distribute the entire
  132.      BPREP Shareware package in an unmodified form for a fee as long as the
  133.      price charged for the disk containing BPREP Shareware does
  134.      not exceed US $10.00.
  135.  
  136.      With this single exception, the sale of BPREP or its parts for profit,
  137.      either alone or together with other software or hardware, requires a
  138.      licensing agreement providing for royalty payments.  Please write for
  139.      terms.
  140.  
  141.  
  142.  
  143. Disclaimer:                                                     Page 2
  144.  
  145.  
  146.  
  147.  
  148.  
  149.      This software (BPREP Shareware) is provided on an "as is" basis without
  150.  
  151.      warranty of any kind, expressed or implied, including but not limited
  152.  
  153.      to the implied warranties of merchantability and fitness for a
  154.  
  155.      particular purpose.  The person using the software bears all risk as to
  156.  
  157.      the quality and performance of the software.  Should the software
  158.  
  159.      prove defective, the user assumes the entire cost of all necessary
  160.  
  161.      repair, servicing, or correction.  The author will not be liable for
  162.  
  163.      any special, incidental, consequential, indirect or similar damages
  164.  
  165.      due to loss of data or any other reason, even if the author or an
  166.  
  167.      agent of the author has been advised of the possibility of such
  168.  
  169.      damages.  In no event shall the author's liability for any damages
  170.  
  171.      ever exceed the price paid for the license to use the software,
  172.  
  173.      regardless of the form of the claim.
  174.  
  175.  
  176.  
  177. Introduction                                                    Page 3
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191. BPREP 2.00
  192.  
  193.  
  194.  
  195.  
  196. BPREP is a preprocessor for the BASIC language.  It adds features
  197.  
  198. usually lacking in most versions of BASIC.  With BPREP you can have
  199.  
  200. conditional compilation, include files and defined constants.  If you are
  201.  
  202. a C programmer you will probably recognize the syntax.  If you have never
  203.  
  204. used a preprocessor before you will soon be wondering how you ever got
  205.  
  206. along without one.  This is a shareware product,  you may try BPREP to see
  207.  
  208. if it fits your needs.  If after a reasonable period of time you find you
  209.  
  210. are still using BPREP you must register.  By registering this product
  211.  
  212. you will receive the professional version which includes many additional
  213.  
  214. features you will also recieve a printed manual, technical support and
  215.  
  216. a subscription to our quarterly newsletter for  one year.
  217.  
  218.  
  219. Alternatively you may register the version which you have at a lower
  220.  
  221. cost and recieve the printed manual and technical support.
  222.  
  223.  
  224.  
  225. Compatibility                                                   Page 4
  226.  
  227.  
  228.  
  229.  
  230.  
  231.  
  232. BPREP can be used with almost any BASIC product that can take input from
  233.  
  234. a normal ascii file.  This includes but is not limited to the following.
  235.  
  236.  
  237.  
  238.  
  239.                         Turbo Basic
  240.  
  241.                         QuickBasic   3.0
  242.  
  243.                         QuickBasic   4.0
  244.  
  245.                         QuickBasic   4.5
  246.  
  247.                         Microsoft PDS 7.0
  248.  
  249.                         Microsoft PDS 7.1
  250.  
  251.                         Power Basic
  252.  
  253.                         GW Basic
  254.  
  255.                         MEQ Basic    (Mars Electronics)
  256.  
  257.                         Intel MCS BASIC 52
  258.  
  259.  
  260.  
  261. If there is a question of compatibility just drop us a line or call
  262.  
  263. 8:00 AM to 5:00 PM Pacific Time.
  264.  
  265.  
  266.  
  267.  
  268.  
  269.                         Applied Design Group
  270.                            (509) 535-7829
  271.  
  272.  
  273.  
  274. Where to Reach us                                               Page 5
  275.  
  276.  
  277.  
  278. The author "Daryl Posnett" can be reached directly at this number
  279.  
  280.  
  281.  
  282.                         Applied Design Group
  283.                            (509) 535-7829
  284.  
  285.  
  286.  
  287. or electronically at one of the following BBS systems:
  288.  
  289.  
  290.                            Local BBS's
  291.                            -----------
  292.  
  293.         SMUG (Spokane Microcomputer User's Group)  (509) 534-1590
  294.         ThinkTank                  (509) 244-6446
  295.  
  296.  
  297.  
  298.  
  299.                          Non-Local BBS's
  300.                          ---------------
  301.  
  302.         Mars Electronics           (215) 430-7165
  303.         Circuit Cellar Ink                  (203) 871-1988
  304.  
  305.  
  306.  
  307. The latest version of BPREP and other Applied Design Group products
  308.  
  309. can alse be found on these bbs systems.  Although it is not the
  310.  
  311. prefered method of reaching us, the authors compuserve ID is
  312.  
  313.                         70540,1756.
  314.  
  315. If contacting us via a local bbs your questions will be answered in a
  316.  
  317. day or so, otherwise it may take as much as a week or more.
  318.  
  319.  
  320.  
  321.  
  322. Using BPREP                                                     Page 6
  323.  
  324.  
  325. BPREP takes arguments from the command line, an input file name and
  326. an output file name and optional switches.  We suggest using  "B" as
  327. an extension for your source files and "BAS" for the output files,
  328. although anything will work
  329.  
  330.  
  331.         ie:
  332.  
  333.                     BPREP myfile.b myfile.bas
  334.  
  335.  
  336.                     myfile.b :
  337.  
  338.                         #define SUM 3+4
  339.                         print SUM
  340.  
  341.  
  342.                     myfile.bas
  343.  
  344.                         print 3+4
  345.  
  346.  
  347.  
  348. so the command line syntax is
  349.  
  350.     BPREP infile outfile
  351.  
  352.  
  353. if you leave off the outfile name BPREP will write to the screen, useful
  354. to see what's going on.
  355.  
  356. #defined names must start with a letter and can consist of numbers,
  357. letters and the underscore "_" character.  Length of names is limited by
  358. memory and common sense.
  359.  
  360.                         Valid names
  361.                         -----------
  362.  
  363.                         TEST_1
  364.                         Version1
  365.                         Version_1_2_3
  366.                         DISTRIB
  367.                         Abcdefgjijklmnopqrstuvwxyz1234567890_____________
  368.  
  369.  
  370.  
  371. Command Line Switches                                           Page 7
  372.  
  373.  
  374. BPREP 2.00 supports two command line switches.
  375.  
  376.  
  377.                 -D<ident>        -  Define a constant from command line
  378.                 -e<filename>     -  Specify a file name for error output
  379.  
  380.  
  381. -D is used to define a constant from the command line.  This is useful
  382.    if you want to make decisions at compile time.  You can specify
  383.    hardware types, version number, version type, etc.
  384.  
  385.  
  386.    Examples:
  387.  
  388.         bprep sample.b sample.bas -DSHAREWARE
  389.  
  390.         bprep comm.b comm.bas -DCOM3 -DCOM4 -DUSES_16450
  391.  
  392.  
  393.  
  394. -e is used to specify an output file for BPREP error messages.  Instead
  395.    of displaying messages on your monitor they will be redirected to a
  396.    file.
  397.  
  398.    Example:
  399.  
  400.         bprep sample.b sample.bas -esample.err
  401.         bprep sample.b sample.bas -eerr.out
  402.  
  403.  
  404.  
  405.  
  406.  
  407.                                                                 Page 8
  408.  
  409.  
  410.  
  411.  
  412.  
  413.  
  414.  
  415.  
  416.  
  417.                              The Directives
  418.  
  419.  
  420.  
  421.             BPREP shareware supports the following directives:
  422.  
  423.  
  424.                                 #include
  425.                                 #define
  426.                                 #undef
  427.                                 #ifdef
  428.                                 #ifndef
  429.                                 #endif
  430.  
  431.  
  432.  
  433. #include                                                        Page 9
  434.  
  435. SYNTAX      :  #include myfile.inc
  436.  
  437. OPERATION   :  The #include directive does not allow quotes around the file
  438.  
  439.                The included file will be opened and processed and can
  440.                include preprocessor directives.  The ouput will be a single
  441.                combined file of all included files.   Include files can
  442.                be nested to a depth of 4 in the SHAREWARE version. In the
  443.                PROFESSIONAL version the number of include files  is
  444.                limited only by available memory and disk space.
  445.  
  446.  
  447.  
  448.  
  449. #define                                                         Page 10
  450.  
  451. SYNTAX      :  #define name definition
  452.  
  453. OPERATION   :  The define directive allows you to replace constants with
  454.                meaningful symbolic names and to define symbols to be
  455.                used with the conditional compilation directives (see
  456.                below).  The name can be any legal basic variable name
  457.                although we suggest using upper case names for defined
  458.                constants and lower and uppercase mixture or lowercase
  459.                only for variables. ie
  460.  
  461.                         #define COMM_PORT 1000
  462.  
  463.                         current_comm_port = COMM_PORT
  464.  
  465.                In the shareware version of BPREP definitions are limited
  466.                to string constants so the following:
  467.  
  468.                             #define SUM 3+4
  469.  
  470.                             sumvar = SUM + 6
  471.  
  472.                      will translate to:
  473.  
  474.                             sumvar = 3+4 + 6
  475.  
  476.  
  477.                 Any text in string literals or comments is left
  478.                 completely intact:
  479.  
  480.                         #define DEFINE "#define"
  481.                         print DEFINE
  482.  
  483.                 becomes:
  484.                         print "#define"
  485.  
  486.  
  487.  
  488.                                                                 Page 11
  489.  
  490.  
  491.                 Names cannot be defined twice to change the value of a
  492.                 #define'd name #undef it first.
  493.  
  494.                         #define SUM 3+4
  495.                         #define SUM 4+5     --- ERROR
  496.  
  497.                         #define SUM 3+4
  498.                         #undef  SUM
  499.                         #define SUM 4+5     --- OK
  500.  
  501.  
  502.                 Names can be used in the expression of a #define
  503.                 statement.
  504.  
  505.                 ie:
  506.                         #define  FIRSTNAME "John"
  507.                         #define  LASTNAME  "Smith"
  508.  
  509.                         #define  NAME    FIRSTNAME + " " + LASTNAME
  510.  
  511.                         name$ =  NAME
  512.  
  513.                 becomes:
  514.  
  515.                         name$ =  "John"+" "+"Smith"
  516.  
  517.  
  518.  
  519.                 If constant expression evaluation is a feature you
  520.                 would like to have then consider purchasing the
  521.                 professional version.
  522.  
  523.                 ie:  (in the PROFESSIONAL VERSION ONLY )
  524.  
  525.                         #define SUM 3+4
  526.                         var = SUM       : becomes var = 7
  527.  
  528.  
  529.  
  530. #undef                                                          Page 12
  531.  
  532. SYNTAX      :  #undef name
  533.  
  534. OPERATION   :  The name is removed from the symbol table further
  535.                references to the name will be ignored.  Use the
  536.                #undef directive to redefine a #defined'd name.
  537.  
  538.  
  539. #ifdef                                                          Page 13
  540.  
  541. SYNTAX      :  #ifdef name
  542.                 ...
  543.                 ...
  544.  
  545.                #endif
  546.  
  547.  
  548. OPERATION   :  The #ifdef directive is used for conditional compilation
  549.                if the name is found the code up until the #endif
  550.                directive is emmitted to the output file, if the symbol
  551.                is not found then no code is emmitted until the #endif is
  552.                reached.
  553.  
  554.  
  555.                example:
  556.  
  557.                         #define VER1
  558.  
  559.                         #ifdef VER1
  560.                             print "My Program Ver 1.0"
  561.                         #endif
  562.  
  563.                         #ifdef VER2
  564.                             print "My Program Ver 2.0"
  565.                         #endif
  566.  
  567.                output:
  568.                         My Program Ver 1.0
  569.  
  570.  
  571.               The shareware version allows #ifdef's and #ifndefs
  572.               to be nested to 8 levels
  573.  
  574.               ie:
  575.                         #ifdef VER1
  576.                         #ifdef UPDATE1
  577.                             print "My Program Ver 1.0 update 1.0"
  578.  
  579.                         #endif
  580.                         #endif
  581.  
  582.  
  583.               if deeper nesting is required the professional version
  584.               allows virtually unlimited nesting.
  585.  
  586.  
  587. #ifndef                                                         Page 14
  588.  
  589. SYNTAX      :  #ifndef name
  590.                 ...
  591.                 ...
  592.  
  593.                #endif
  594.  
  595.  
  596. OPERATION   :  The #ifndef directive is used for conditional compilation
  597.                if the name is not found the code up until the #endif
  598.                directive is emmitted to the output file, if the symbol
  599.                is found then no code is emmitted until the #endif is
  600.                reached.
  601.  
  602.  
  603.  
  604. #endif                                                          Page 15
  605.  
  606. SYNTAX      :  #endif
  607.  
  608. OPERATION   :  #endif terminates an #ifdef or #ifndef block
  609.  
  610.  
  611.  
  612.  
  613. Professional Version                                            Page 16
  614.  
  615.  
  616.  
  617.  
  618.  
  619. The professional version includes the following additional features:
  620.  
  621.  
  622.  
  623.  
  624.   Constant expression evaluation : defines can be arithmetic expressions
  625.                                    as well as strings.
  626.  
  627.  
  628.   Nested conditional directives  : unlimited nesting of   #ifdef,
  629.                                    #ifndef, etc.
  630.  
  631.  
  632.  
  633.   Line number generation for line number basics.
  634.  
  635.  
  636.  
  637.   The following additional directives:
  638.  
  639.                             #cf
  640.                             #cmts
  641.                             #date
  642.                             #direcs
  643.                             #display
  644.                             #else
  645.                             #elseif
  646.                             #endm
  647.                             #error
  648.                             #fatal
  649.                             #if
  650.                             #macro
  651.                             #nocf
  652.                             #nocmts
  653.                             #nodirecs
  654.                             #nowarn
  655.                             #repeat
  656.                             #time
  657.                             #warn
  658.                             #warning
  659.  
  660. Registration Information                                        Page 17
  661.  
  662.  
  663.  
  664.  
  665.  
  666.         BPREP is NOT FREE Software.  If you wish to continue using BPREP
  667.         you must register.
  668.  
  669.  
  670.  
  671.  
  672.  
  673.         Q : What do I get if I register ?
  674.  
  675.         A : BPREP Shareware is a complete and usable program as is
  676.             however, by registering you will recieve the latest version
  677.             of BPREP Professional the enhanced BASIC Preprocessor which
  678.             includes many additional features not found in
  679.             BPREP Shareware.  So this is what you will recieve
  680.  
  681.  
  682.                         - BPREP Professional 2.00 on disk
  683.                         - A Printed manual
  684.                         - Unlimited Technical Support
  685.                         - Quarterly Newsletter
  686.                                (for 1 year)
  687.  
  688.                                                              $34.95
  689.  
  690.  
  691.  
  692.  
  693.  
  694.  
  695.         Q : I'd like to register for the technical support and manual
  696.             but  I don't need the power of BPREP Professional.
  697.  
  698.         A : You can register your copy of BPREP Shareware and receive
  699.             the printed manual and technical support for only:
  700.  
  701.                                                              $14.95.
  702.  
  703.  
  704.  
  705.  
  706. Other Applied Design Group Products                             Page 18
  707.  
  708.  
  709.  
  710.  
  711.  
  712.  
  713. ASM51 8051/8031 Macro Cross Assembler
  714.  
  715.         A full featured Cross Assembler for the Intel 8051/8031
  716.         series of microprocessors.  Generates Intel HEX files or
  717.         binary image output.
  718.                                                          $39.95
  719.  
  720.  
  721.  
  722.  
  723.  
  724.  
  725.  
  726. BAS51 8051/8031 Basic Cross Compiler
  727.  
  728.         A BASIC compiler for the 8051 that supports most features
  729.         of the BASIC language.  Use structured contstructs
  730.         while/wend, do/loop, block if/then.  Generates good tight
  731.         code and no line numbers are required. Get those 8051
  732.         projects done in less time.
  733.  
  734.                                                          $99.95
  735.  
  736.  
  737.  
  738.  
  739.  
  740.  
  741. BAS51 Professional
  742.  
  743.         A complete package including BAS51 Compiler, ASM51 Assembler
  744.         and BPREP Professional, as well as several other utilities to
  745.         help you write 8051 code.
  746.                                                         $149.95
  747.  
  748.  
  749.  
  750.  
  751.    BPREP version 2.00                                     Order Form
  752.    -----------------------------------------------------------------
  753.      Make checks payable to:
  754.        Applied Design Group
  755.        E 3707 Pacific
  756.        Spokane, WA 99202
  757.    -----------------------------------------------------------------
  758.    Qty
  759.  
  760.    [ ] BPREP Shareware                   @  $14.95 each      $______
  761.  
  762.    [ ] BPREP Professional 2.00           @  $34.95 each      $______
  763.  
  764.    [ ] ASM51
  765.        8051/8031 Macro Cross Assembler   @  $39.95 each      $______
  766.  
  767.    [ ] BAS51
  768.        8051/8031 Basic Cross Compiler    @  $99.95 each      $______
  769.  
  770.    [ ] BAS51 Professional
  771.        8051/8031 Basic Cross Compiler
  772.        Includes Macro Assembler
  773.        and BPREP Professional            @ $149.95 each      $______
  774.  
  775.                                                 Subtotal     $______
  776.  
  777.        Washington residents please add 8.0% sales tax.       $______
  778.  
  779.        Shipping and handling                                   $3.50
  780.  
  781.                                                      Total   $______
  782.  
  783.        Diskette type :  [ ] 5.25"         [ ] 3.5"
  784.  
  785.        Payment       :  [ ] Check         [ ] Money Order
  786.  
  787.    Checks and Money Orders must be drawn on U.S. banks in U.S. funds
  788.    -----------------------------------------------------------------
  789.  
  790.    Name      _______________________________________________________
  791.  
  792.    Company   _______________________________________________________
  793.  
  794.    Address   _______________________________________________________
  795.  
  796.              _______________________________________________________
  797.  
  798.    Phone     _____________________  Business  ______________________
  799.  
  800.  
  801.    Where did you obtain BPREP?
  802.  
  803.              _______________________________________________________
  804.  
  805.    Comments  _______________________________________________________
  806.  
  807.              _______________________________________________________
  808.  
  809.  
  810.  
  811.          ----------------end-of-author's-documentation---------------
  812.  
  813.                          Software Library Information:
  814.  
  815.                     This disk copy provided as a service of
  816.  
  817.                            Public (software) Library
  818.  
  819.          We are not the authors of this program, nor are we associated
  820.          with the author in any way other than as a distributor of the
  821.          program in accordance with the author's terms of distribution.
  822.  
  823.          Please direct shareware payments and specific questions about
  824.          this program to the author of the program, whose name appears
  825.          elsewhere in  this documentation. If you have trouble getting
  826.          in touch with the author,  we will do whatever we can to help
  827.          you with your questions. All programs have been tested and do
  828.          run.  To report problems,  please use the form that is in the
  829.          file PROBLEM.DOC on many of our disks or in other written for-
  830.          mat with screen printouts, if possible.  PsL cannot debug pro-
  831.          programs over the telephone, though we can answer questions.
  832.  
  833.          Disks in the PsL are updated  monthly,  so if you did not get
  834.          this disk directly from the PsL, you should be aware that the
  835.          files in this set may no longer be the current versions. Also,
  836.          if you got this disk from another vendor and are having prob-
  837.          lems,  be aware that  some files may have become corrupted or
  838.          lost by that vendor. Get a current, working disk from PsL.
  839.  
  840.          For a copy of the latest monthly software library newsletter
  841.          and a list of the 4,000+ disks in the library, call or write
  842.  
  843.                            Public (software) Library
  844.                                P.O.Box 35705 - F
  845.                             Houston, TX 77235-5705
  846.  
  847.                                 1-800-2424-PSL
  848.                              MC/Visa/AmEx/Discover
  849.  
  850.                           Outside of U.S. or in Texas
  851.                           or for general information,
  852.                               Call 1-713-524-6394
  853.  
  854.                           PsL also has an outstanding
  855.                           catalog for the Macintosh.
  856.  
  857.